package NumberOfDigitOne;

public class Solution {
    public int countDigitOne(int n) {
        return 0;
    }


    private static int getOneCount(int n) {
        int result = 0;
        if (n < 10) {
            return n == 1 ? 1 : 0;
        }
        while (n / 10 > 1) {
            int j = n % 10;
            if (j == 1) {
                result++;
            }
            n /= 10;
        }
        return result;
    }

    public static void main(String[] args) {
        System.out.println(getOneCount(10));
    }


}
